<!-- +----------------------------------------------------------------------
| 麦沃德科技赋能开发者，助力中小企业发展 
+----------------------------------------------------------------------
| Copyright (c) 2017～2024  www.wdadmin.cn    All rights reserved.
+----------------------------------------------------------------------
| 沃德代驾系统并不是自由软件，不加密，并不代表开源，未经许可不可自由转售和商用
+----------------------------------------------------------------------
| Author: MY WORLD Team <bd@maiwd.cn>   www.wdadmin.cn
+----------------------------------------------------------------------
| 开发票 开发者: 麦沃德科技-半夏  
+---------------------------------------------------------------------- -->

<template>
	<view class="container" :style="{'--theme-color': themeColor}">
		<view class="container-main">
			<view class="main-column flex flex-between-center" @click="toInvoiceOrder()">
				<view class="column-title">按订单开票</view>
				<image class="column-icon" src="/static/arrow_right.png" mode="aspectFit"></image>
			</view>
			<view class="main-card">
				<view class="card-title">发票服务</view>
				<view class="card-menu flex flex-wrap">
					<view class="menu-item" @click="toInvoiceHistory()">
						<view class="item-icon" :style="{'background-image': 'url('+ serviceIcon +')'}" v-if="serviceIcon"></view>
						<view class="item-text">开票历史</view>
					</view>
					<view class="menu-item" @click="toInvoiceTitle()">
						<view class="item-icon" :style="{'background-image': 'url('+ serviceIcon +')'}" v-if="serviceIcon"></view>
						<view class="item-text">常用发票抬头</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { mapState } from "vuex"
	import svgData from "@/common/svg.js"
	export default {
		data() {
			return {

			}
		},
		computed: {
			...mapState({
				themeColor: state => state.app.themeColor,
				serviceIcon: state => {
					return svgData.svgToUrl("service", state.app.themeColor)
				}
			})
		},
		onLoad() {

		},
		methods: {
			// 跳转订单列表
			toInvoiceOrder() {
				this.$util.toPage({
					mode: 1,
					path: "/pages/passenger/mine/invoice/order",
					isToken: true,
				})
			},
			// 跳转开票历史
			toInvoiceHistory() {
				this.$util.toPage({
					mode: 1,
					path: "/pages/passenger/mine/invoice/history",
					isToken: true,
				})
			},
			// 跳转常用发票抬头
			toInvoiceTitle() {
				this.$util.toPage({
					mode: 1,
					path: "/pages/passenger/mine/invoice/title",
					isToken: true,
				})
			},
		}
	}
</script>

<style lang="scss">
	.container {
		padding: 32rpx;

		.container-main {
			.main-column {
				padding: 42rpx 48rpx;
				border-radius: 32rpx;
				background: #FFF;

				.column-title {
					color: #242629;
					font-size: 32rpx;
					font-weight: 600;
					line-height: 44rpx;
				}

				.column-icon {
					width: 24rpx;
					height: 24rpx;
					margin-left: 32rpx;
				}
			}

			.main-card {
				margin-top: 32rpx;
				padding: 42rpx 48rpx;
				border-radius: 32rpx;
				background: #FFF;

				.card-title {
					color: #242629;
					font-size: 32rpx;
					font-weight: 600;
					line-height: 44rpx;
				}

				.card-menu {
					.menu-item {
						margin-top: 48rpx;
						width: 50%;
						display: flex;
						flex-direction: column;
						align-items: center;

						.item-icon {
							width: 64rpx;
							height: 64rpx;
							background-size: 64rpx;
						}

						.item-text {
							margin-top: 32rpx;
							color: #242629;
							text-align: center;
							font-size: 28rpx;
							font-weight: 600;
							line-height: 40rpx;
						}
					}
				}
			}
		}
	}
</style>